
package oracle.apps.financials.collection.activity;

import greendroid.widget.ItemAdapter;
import greendroid.widget.item.TextItem;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import com.cyrilmottier.android.greendroid.R;

public class MainActivity extends BaseListActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		ItemAdapter adapter = new ItemAdapter(this);
		adapter.add(createTextItem(R.string.top_delinquent_customer, TopDelinquentCustomerActivity.class));
		adapter.add(createTextItem(R.string.web_service, WebServiceActivity.class));	
		setListAdapter(adapter);

	}

	private TextItem createTextItem(int stringId, Class<?> classObject) {
		final TextItem textItem = new TextItem(getString(stringId));
		textItem.setTag(classObject);
		return textItem;
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		final TextItem textItem = (TextItem) l.getAdapter().getItem(position);
		Intent intent = new Intent(MainActivity.this, (Class<?>) textItem.getTag());
		startActivity(intent);
	}

	
}
